<template>
  <!-- <nav>
    <router-link to="/">Home</router-link> |
    <router-link to="/about">About</router-link>
  </nav> -->
  <router-view/>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import router from './router';
import { getToken } from './utils/request';

export default defineComponent({
  setup(){
    /*const token=getToken()
    router.beforeEach((to, from, next)=>{
      //console.log(to,from)
      // 在导航前执行操作，例如身份验证检查
      if(to.path=='/'){
        if(token){
          next()
        }else{
          next('/login'); // 重定向到登录页
        }
      }else{
        next();
      }
    })*/
  }
})
</script>
<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100%;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
